<?php
$client = new swoole_client(SWOOLE_SOCK_TCP, SWOOLE_SOCK_ASYNC); //异步非阻塞

$client->on("connect", function($cli) {
    echo "connected\n";
    $cli->send('{"url":"", "seq":"1", "param1":"p1", "param2":"p2"}'."\r\n");
});

$client->on("receive", function($cli, $data) 
{
        echo "received: $data\n";
});

$client->on("error", function($cli){
    exit("error\n");
});

$client->on("close", function($cli){
    echo "connection is closed\n";
});

$client->connect('127.0.0.1', 29090, 0.5);